package com.shg.controller;

import com.shg.domain.ResponseResult;
import com.shg.domain.User;
import com.shg.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @DESCRIPTION:
 * @USER: shg
 * @DATE: 2023/5/5 12:10
 */
@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    // 登录接口
    @PostMapping(value = "/user/login")
    public ResponseResult login(@RequestBody User user){
        return loginService.login(user);
    }

    // 退出接口
    @GetMapping(value = "/user/logout")
    public ResponseResult logout(){
        return loginService.logout();
    }
}
